home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / Issue38 / Clinic / KeyTestU.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1998-07-07  |  599 b   |  35 lines

  1. unit KeyTestU;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  7.   StdCtrls;
  8.  
  9. type
  10.   TForm1 = class(TForm)
  11.     Label1: TLabel;
  12.   public
  13.     procedure WMKeyDown(var Msg: TWMKeyDown);
  14.       message wm_KeyDown;
  15.   end;
  16.  
  17. var
  18.   Form1: TForm1;
  19.  
  20. implementation
  21.  
  22. {$R *.DFM}
  23.  
  24. procedure TForm1.WMKeyDown(var Msg: TWMKeyDown);
  25. var
  26.   KeyName: array[0..255] of Char;
  27. begin
  28.   if GetKeyNameText(Msg.KeyData, KeyName, SizeOf(KeyName)) > 0 then
  29.     Caption := StrPas(KeyName)
  30.   else
  31.     Caption := 'Oops - it''s not working...'
  32. end;
  33.  
  34. end.
  35.